define NUMBER_OF_TOWNS = 6

define script CreatureSelect
define script actioncreature
define script selCstuff
define script CreatureA2

global oCreature = 0
global aCreature = 0 
global tCreature = 0
global lCreature = 0
global wCreature = 0
global cCreature = 0
global gCreature = 0
global pikC = 0
global ChoNot = 0
global camerapos = 0 
global Ceneterpos = 0
global pickedcreature = 0
global Town[NUMBER_OF_TOWNS]

begin script CreatureSelect
	oTown = 0
	Tele1 = 0
	lPos = 0
	nTown = 0 
	sPos = marker at {1021, 23, 470} // not important
	field1 = 0
	Player01 = 0
	oPen = 0
	vis1 = 0


start
	//By Willy (Creating the creatures)
	Ceneterpos = marker at {Town[0]}+{50,50}
	camerapos = marker at {Ceneterpos}+{-10, 30,-10}
	begin cinema
		wait 3 seconds
		set camera position to {Ceneterpos}+{-10, 30,-10}
		set camera focus to {Town[0]}+{50,50} 
		set fade in time 1
	end cinema
	gCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_GORILLA at {Ceneterpos}+{0,0,20} using only alignment good neutral evil
	set creature gCreature energy to 1.0
	set creature gCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature gCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	wCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {Ceneterpos}+{0,0,-20} using only alignment good neutral evil
	set creature wCreature energy to 1.0
	set creature wCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature wCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	aCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_APE at {Ceneterpos}+{10,0,-10} using only alignment good neutral evil
	set creature aCreature energy to 1.0
	set creature aCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature aCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	lCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_LION at {Ceneterpos}+{10,0,10} using only alignment good neutral evil
	set creature lCreature energy to 1.0
	set creature lCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature lCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	tCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_TIGER at {Ceneterpos}+{5,0,15} using only alignment good neutral evil
	set creature tCreature energy to 1.0
	set creature tCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature tCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	cCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_COW at {Ceneterpos}+{5,0,-15} using only alignment good neutral evil
	set creature cCreature energy to 1.0
	set creature cCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
	set creature cCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_ALIGNMENT 0
	wait 1 seconds
	force tCreature CREATURE_IDLE tCreature at {Ceneterpos}
	force cCreature CREATURE_IDLE cCreature at {Ceneterpos}
	force lCreature CREATURE_IDLE lCreature at {Ceneterpos}
	force aCreature CREATURE_IDLE aCreature at {Ceneterpos}
	force wCreature CREATURE_IDLE wCreature at {Ceneterpos}
	force gCreature CREATURE_IDLE gCreature at {Ceneterpos}
	wait 1 seconds
	snap creature cCreature focus to {camerapos}
	snap creature tCreature focus to {camerapos}
	snap creature lCreature focus to {camerapos}
	snap creature gCreature focus to {camerapos}
	snap creature wCreature focus to {camerapos}
	snap creature aCreature focus to {camerapos}
	wait 2 seconds
	run background script actioncreature
	run background script selCstuff
end script CreatureSelect

begin script actioncreature
	HandPos = 0
	sadMaker = 0
	oPen = 0
	Tele1 = 0
start
	//By Willy (the creatures actions)
	if pikC == 0
		begin loop
			play anim C_CS_DANCE_BASIC on gCreature
			play anim C_INDIVIDUAL_SCRATCH on aCreature
			play anim C_INDIVIDUAL_EMBARRASSED on wCreature
			play anim C_IDLE_FIDGET02 on tCreature
			play anim C_INDIVIDUAL_TAUNT on lCreature
			play anim C_INDIVIDUAL_FRIENDLY_WAVE on cCreature
			wait 3 seconds
			play anim C_DANCE_A on gCreature
			play anim C_IDLE_FIDGET03 on aCreature
			play anim C_FACE_GROWL on wCreature
			play anim C_INDIVIDUAL_SHAKEOFF on tCreature
			play anim C_CS_INTRO_TURN_ROAR on lCreature
			play anim C_INDIVIDUAL_IMPRESS on cCreature
			wait 3 seconds
		end loop
	end if
end script actioncreature

begin script selCstuff
	oPen = 0
	Tele1 = 0
	food001 = 0
	CreatFin = 0
	PickAlR = 0
start
	// By Willy controling the actions.
	begin loop
		if gCreature right clicked
			pikC = 1
		elsif tCreature right clicked
			pikC = 2	
		elsif wCreature right clicked
			pikC = 3	
		elsif aCreature right clicked
			pikC = 4				
		elsif lCreature right clicked
			pikC = 5				
		elsif cCreature right clicked
			pikC = 6					
		end if	
		until pikC !=0
	end loop
	stop script "actioncreature" 
	clear right clicked object
	clear left clicked object
	clear right button clicked
	clear left button clicked
	if pikC !=0
		begin loop
			run background script CreatureA2
			if ChoNot == 1
				clear right clicked object
				clear left clicked object
				clear right button clicked
				clear left button clicked
				PickAlR = 1
			end if
			ChoNot = 0
			if pikC == 1
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {gCreature} time -1
				begin loop
					if gCreature right clicked 
						pickedcreature = 1
						pikC = 7
						CreatFin = 1
						ChoNot = 0
					elsif tCreature right clicked
						pickedcreature = 2
						pikC = 2
						ChoNot = 1
						stop visual effect Tele1
					elsif wCreature right clicked
						pickedcreature = 3
						pikC = 3
						ChoNot = 1
						stop visual effect Tele1
					elsif aCreature right clicked
						pickedcreature = 4
						pikC = 4
						ChoNot = 1
						stop visual effect Tele1
					elsif lCreature right clicked
						pickedcreature = 5
						pikC = 5
						ChoNot = 1
						stop visual effect Tele1
					elsif cCreature right clicked
						pickedcreature = 6
						pikC = 6
						ChoNot = 1
						stop visual effect Tele1
					end if
					until pikC == 7 or ChoNot == 1
				end loop
			elsif pikC == 3
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {wCreature} time -1
				begin loop
					if wCreature right clicked 
						pikC = 7
						CreatFin = 1
						ChoNot = 0
						pickedcreature = 3
					elsif tCreature right clicked
						pickedcreature = 2
						pikC = 2
						ChoNot = 1
						stop visual effect Tele1
					elsif gCreature right clicked
						pikC = 1
						ChoNot = 1
						stop visual effect Tele1
					elsif aCreature right clicked
						pickedcreature = 4
						pikC = 4
						ChoNot = 1
						stop visual effect Tele1
					elsif lCreature right clicked
						pickedcreature = 5
						pikC = 5
						ChoNot = 1
						stop visual effect Tele1						
					elsif cCreature right clicked
						pikC = 6
						pickedcreature = 6
						ChoNot = 1
						stop visual effect Tele1
					end if	
					until pikC == 7 or ChoNot == 1
				end loop
			elsif pikC == 4
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {aCreature} time -1
				begin loop
					if aCreature right clicked 
						pikC = 7
						CreatFin = 1
						ChoNot = 0
						pickedcreature = 4
					elsif tCreature right clicked
						pickedcreature = 2
						pikC = 2
						ChoNot = 1
						stop visual effect Tele1
					elsif gCreature right clicked
						pikC = 1
						ChoNot = 1
						stop visual effect Tele1
					elsif wCreature right clicked
						pickedcreature = 3
						pikC = 3
						ChoNot = 1
						stop visual effect Tele1
					elsif lCreature right clicked
						pikC = 5	
						ChoNot = 1
						stop visual effect Tele1
						pickedcreature = 5
					elsif cCreature right clicked
						pikC = 6
						pickedcreature = 6
						ChoNot = 1
						stop visual effect Tele1
					end if	
					until pikC == 7 or ChoNot == 1
				end loop
			elsif pikC == 2
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {tCreature} time -1
				begin loop
					if tCreature right clicked 
						pikC = 7
						CreatFin = 1
						ChoNot = 0
						pickedcreature = 2
					elsif aCreature right clicked
						pickedcreature = 4
						pikC = 4
						ChoNot = 1
						stop visual effect Tele1
					elsif gCreature right clicked
						pikC = 1
						ChoNot = 1
						stop visual effect Tele1
					elsif wCreature right clicked
						pickedcreature = 3
						pikC = 3
						ChoNot = 1
						stop visual effect Tele1
					elsif lCreature right clicked
						pickedcreature = 5
						pikC = 5
						ChoNot = 1
						stop visual effect Tele1
					elsif cCreature right clicked
						pikC = 6
						pickedcreature = 6
						ChoNot = 1
						stop visual effect Tele1
					end if	
					until pikC == 7 or ChoNot == 1
				end loop
			elsif pikC == 5
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {lCreature} time -1
				begin loop
					if lCreature right clicked 
						pikC = 7
						CreatFin = 1
						ChoNot = 0
						pickedcreature = 5
					elsif aCreature right clicked
						pickedcreature = 4
						pikC = 4
						ChoNot = 1
						stop visual effect Tele1
					elsif gCreature right clicked
						pikC = 1
						ChoNot = 1
						stop visual effect Tele1
					elsif wCreature right clicked
						pickedcreature = 3
						pikC = 3
						ChoNot = 1
						stop visual effect Tele1
					elsif tCreature right clicked
						pickedcreature = 2
						pikC = 2
						ChoNot = 1
						stop visual effect Tele1
					elsif cCreature right clicked
						pikC = 6
						pickedcreature = 6
						ChoNot = 1
						stop visual effect Tele1
					end if	
					until pikC == 7 or ChoNot == 1
				end loop
			elsif pikC == 6
				Tele1 = create visual effect VISUAL_EFFECT_CREATURE_SELECT at {cCreature} time -1
				begin loop
					if cCreature right clicked 
						pikC = 7
						pickedcreature = 6
						CreatFin = 1
						ChoNot = 0
					elsif aCreature right clicked
						pickedcreature = 4
						pikC = 4
						ChoNot = 1
						stop visual effect Tele1
					elsif gCreature right clicked
						pikC = 1
						ChoNot = 1
						stop visual effect Tele1
					elsif wCreature right clicked
						pickedcreature = 3
						pikC = 3
						ChoNot = 1
						stop visual effect Tele1
					elsif tCreature right clicked
						pickedcreature = 2
						pikC = 2
						ChoNot = 1
						stop visual effect Tele1
					elsif lCreature right clicked
						pickedcreature = 5
						pikC = 5
						ChoNot = 1
						stop visual effect Tele1
					end if	
					until pikC == 7 or ChoNot == 1
				end loop
			end if
			until CreatFin == 1 and ChoNot == 0
		end loop
	end if
	wait until aCreature right clicked or gCreature right clicked or wCreature right clicked or lCreature right clicked or tCreature right clicked or cCreature right clicked 
		if pikC == 7
			if gCreature right clicked
				begin fullscreen cinema
					move camera focus to {gCreature}+{0,7,0} time 5
					move camera position to {gCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete gCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_GORILLA at {Ceneterpos} using only alignment good neutral
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete wCreature
					delete tCreature
					delete aCreature
					delete cCreature
					delete lCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			elsif aCreature right clicked
				begin fullscreen cinema
					move camera focus to {aCreature}+{0,7,0} time 5
					move camera position to {aCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete aCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_APE at {Ceneterpos} using only alignment good neutral evil
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete wCreature
					delete tCreature
					delete gCreature
					delete cCreature
					delete lCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			elsif wCreature right clicked
				begin fullscreen cinema
					move camera focus to {wCreature}+{0,7,0} time 5
					move camera position to {wCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete wCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_WOLF at {Ceneterpos} using only alignment good neutral evil
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete gCreature
					delete tCreature
					delete aCreature
					delete cCreature
					delete lCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			elsif lCreature right clicked
				begin fullscreen cinema
					move camera focus to {lCreature}+{0,7,0} time 5
					move camera position to {lCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete lCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_LION at {Ceneterpos} using only alignment good neutral evil
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete wCreature
					delete tCreature
					delete aCreature
					delete cCreature
					delete gCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			elsif tCreature right clicked
				begin fullscreen cinema
					move camera focus to {tCreature}+{0,7,0} time 5
					move camera position to {tCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete tCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_TIGER at {Ceneterpos} using only alignment good neutral evil
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete wCreature
					delete gCreature
					delete aCreature
					delete cCreature
					delete lCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			elsif cCreature right clicked
				begin fullscreen cinema
					move camera focus to {cCreature}+{0,7,0} time 5
					move camera position to {cCreature}+{0,9,0} time 5
					wait 2 seconds
					set fade red 0 green 0 blue 0 time 2
					wait 4 seconds
					delete cCreature
					oCreature = create SCRIPT_OBJECT_TYPE_CREATURE CREATURE_TYPE_COW at {Ceneterpos} using only alignment good neutral evil
					stop visual effect Tele1
					set creature oCreature CREATURE_SCRIPT_TRANSITIONAL_ATTRIBUTE_TYPE_SIZE 0.5
					delete wCreature
					delete tCreature
					delete aCreature
					delete gCreature
					delete lCreature
					oPen = get OBJECT_TYPE_ABODE ABODE_NUMBER_CREATURE_PEN at {Town[0]} radius 200 
					set camera position to {camerapos}
					set fade in time 3
					wait 3 seconds
				end cinema
				set player 0 creature to oCreature
				set oCreature home position {Ceneterpos}
			end if
		end if
	teach oCreature all
	set oCreature DEVELOPMENT_PHASE_FULLY_MATURE development
	set oCreature desire CREATURE_DESIRE_TO_LOOK_AROUND to 1.0
	set oCreature desire CREATURE_DESIRE_WANDERLUST to 1.0
	set oCreature desire CREATURE_DESIRE_TO_IMPRESS to 1.0
	set oCreature desire CREATURE_DESIRE_CURIOSITY to 1.0
	set oCreature desire CREATURE_DESIRE_TO_STAY_NEAR_HOME to 0
	set oCreature desire CREATURE_DESIRE_TO_HANG_AROUND_AT_HOME to 0
	set oCreature desire CREATURE_DESIRE_TO_STEAL to 1.0
	set oCreature desire CREATURE_DESIRE_TO_ATTACK_TOWN to 1.0
	set oCreature desire CREATURE_DESIRE_MISCHIEF to 1.0
	set oCreature desire CREATURE_DESIRE_TO_PERFORM_EXPRESSIVE_IDLE to 0
	set oCreature desire CREATURE_DESIRE_TO_STAY_IN_FRIENDLY_TERRITORY to 0
	set oCreature desire CREATURE_DESIRE_ANGER to 1.0
	set oCreature desire CREATURE_DESIRE_HUNGER to 0.3
end script selCstuff

begin script CreatureA2

start
	begin loop
		if pikC == 6 or pickedcreature == 6
				play anim C_CS_SAD_LOOP1 on gCreature
				play anim C_CS_SAD_LOOP1 on aCreature
				play anim C_CS_SAD_LOOP1 on wCreature
				play anim C_CS_SAD_LOOP1 on tCreature
				play anim C_CS_SAD_LOOP2 on lCreature
				play anim C_INDIVIDUAL_HAPPY3 on cCreature
				wait 3 seconds
		elsif pikC == 1 or pickedcreature == 1
				play anim C_CS_SAD_LOOP1 on cCreature
				play anim C_CS_SAD_LOOP2 on aCreature
				play anim C_CS_SAD_LOOP2 on wCreature
				play anim C_CS_SAD_LOOP1 on tCreature
				play anim C_CS_SAD_LOOP1 on lCreature
				play anim C_INDIVIDUAL_HAPPY3 on gCreature
				wait 3 seconds
		elsif pikC == 3 or pickedcreature == 3
				play anim C_CS_SAD_LOOP2 on cCreature
				play anim C_CS_SAD_LOOP1 on aCreature
				play anim C_CS_SAD_LOOP2 on gCreature
				play anim C_CS_SAD_LOOP1 on tCreature
				play anim C_CS_SAD_LOOP2 on lCreature
				play anim C_INDIVIDUAL_HAPPY3 on wCreature
				wait 3 seconds
		elsif pikC == 2 or pickedcreature == 2
				play anim C_CS_SAD_LOOP2 on cCreature
				play anim C_CS_SAD_LOOP1 on aCreature
				play anim C_CS_SAD_LOOP2 on wCreature
				play anim C_CS_SAD_LOOP2 on gCreature
				play anim C_CS_SAD_LOOP1 on lCreature
				play anim C_INDIVIDUAL_HAPPY3 on tCreature
				wait 3 seconds
		elsif pikC == 5 or pickedcreature == 5
				play anim C_CS_SAD_LOOP2 on cCreature
				play anim C_CS_SAD_LOOP1 on aCreature
				play anim C_CS_SAD_LOOP1 on wCreature
				play anim C_CS_SAD_LOOP1 on tCreature
				play anim C_CS_SAD_LOOP2 on gCreature
				play anim C_INDIVIDUAL_HAPPY3 on lCreature
				wait 3 seconds
		elsif pikC == 4 or pickedcreature == 4
				play anim C_CS_SAD_LOOP1 on cCreature
				play anim C_CS_SAD_LOOP2 on gCreature
				play anim C_CS_SAD_LOOP2 on wCreature
				play anim C_CS_SAD_LOOP1 on tCreature
				play anim C_CS_SAD_LOOP1 on lCreature
				play anim C_INDIVIDUAL_HAPPY3 on aCreature
				wait 3 seconds
		end if
	end loop
end script CreatureA2